package miao.byusi.bkata.logs

/**
 * 日志主题样式配置
 */
class Theme {
    private val styles = mutableMapOf<LogLevel, Style>()
    
    fun setStyle(level: LogLevel, style: Style) {
        styles[level] = style
    }
    
    fun getStyle(level: LogLevel): Style {
        return styles[level] ?: getDefaultStyle(level)
    }
    
    private fun getDefaultStyle(level: LogLevel): Style {
        return when (level) {
            LogLevel.DEBUG -> Style(color = Color.BRIGHT_BLACK)
            LogLevel.INFO -> Style(color = Color.WHITE)
            LogLevel.WARNING -> Style(color = Color.YELLOW)
            LogLevel.ERROR -> Style(color = Color.RED)
            LogLevel.CRITICAL -> Style(color = Color.WHITE, bgColor = Color.RED, bold = true)
        }
    }
}